package com.sp.biz.user.controller;

import com.sp.common.vo.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 
 * @since 2024-01-26 15:43:18
 */
@RestController
@RequestMapping("/user-do")
@Tag(name = "用户管理")
public class UserController {

    @Resource
    RedisTemplate<String,Object> redisTemplate;


    @GetMapping("/userInfo")
    @Operation(summary = "userInfo",description = "获取用户信息")
    public Result getUserInfo(){

        redisTemplate.opsForValue().set("userInfo","userInfo");

        //获取用户数据
        return Result.succeed(redisTemplate.opsForValue().get("userInfo"));
    }


    @GetMapping("/setUserInfo")
    @Operation(summary = "获取用户信息",description = "获取用户信息")
    public Result setUserInfo(){
        Object  userInfo = redisTemplate.opsForValue().get("userInfo");
        //获取用户数据
        return Result.succeed(userInfo);
    }
}
